package com.woniuxy.searchassembly.dao;

import com.woniuxy.searchassembly.model.SightPoint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-05-24
 */
@Mapper
public interface SightPointMapper extends BaseMapper<SightPoint> {

    /*根据区域名字选出特定某个区的所有景点*/
    @Select("select name from sight_point where area = #{area}")
    List<String> queryArea(String area);

    /*根据景点名称直接精确找到这个景区的经纬度*/
    @Select("select * from sight_point where name = #{area}")
    SightPoint querySightInfo(String area);

    /*新增景区*/
    @Insert("insert into sight_point (name,area,longitude,latitude)values(#{name},#{area},#{longitude},#{latitude})")
    int addNewSight(SightPoint sightPoint);

}
